<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1.0,minimum-scale=1.0, user-scalable=no">
    <title>{:lang('Mine')}</title>
    <script src="__STATIC__/hybit/js/rem.js"></script>
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css">
    <link rel="stylesheet" href="__STATIC__/hybit/css/myCommon.css">
    <if cookie('think_var') == 'en-us'>
        <link rel="stylesheet" href="__STATIC__/hybit/css/style_en.css">
    <else/>
        <link rel="stylesheet" href="__STATIC__/hybit/css/style.css">
    </if>
</head>
<body>
    <div class="head" style="background: #1D1D1D;">
       <p style="color:#fff;">{:lang('Mine')}</p>
    </div>
    <div class="indexbg headhead">
       <p class="z_newheadp">{:lang('Mine')}</p>
        <div class="myhead">
            <div>
                <p class="myheadp1">
                    {$user['user_nickname']?$user['user_nickname']:($user['mobile']?$user['mobile']:$user['user_email'])}
                    <a onclick="showalert(this)">
                        <img src="__STATIC__/hybit/images/xiugai.png" alt="">
                    </a>
                </p>
                <p class="myheadp2">
                    <a><if is_auth()>{:lang('Certified')}<else/>{:lang('Not Certified')}</if></a>
                    <a>{:level($user.id)['name']}</a>
                    <if $user_relation['director']><a>{:lang('Director')}</a></if>
                </p>
            </div>
            <img src="<if $user.avatar>{:cmf_get_image_preview_url($user.avatar)}<else/>__STATIC__/hybit/images/header.png</if>" id="header" alt="">
        </div>
        <div class="mynav">
            <div class="navlist">
                <p class="navlisthead">{:lang('Basic Skills')}</p>
                <div class="navlistall">
                    <a href="{:url('user/profile/center')}"><img src="__STATIC__/hybit/images/my_grzx.png" alt=""><p>{:lang('Personal Center')}</p></a>
                    <a href="{:url('user/profile/save')}"><img src="__STATIC__/hybit/images/my_aqzx.png" alt=""><p>{:lang('Security Center')}</p></a>
                    <a href="{:url('user/zichan/index')}"><img src="__STATIC__/hybit/images/my_zcgl.png" alt=""><p>{:lang('Asset Management')}</p></a>
                    <a href="{:url('user/address/index')}"><img src="__STATIC__/hybit/images/my_dzgl.png" alt=""><p>{:lang('Withdraw Address')}</p></a>
                </div>
            </div>
            <div class="navlist">
                <p class="navlisthead">{:lang('Basic Skills')}</p>
                <div class="navlistall">
                    <a href="{:url('user/share/index')}"><img src="__STATIC__/hybit/images/my_fxhy.png" alt=""><p>{:lang('Share Friends')}</p></a>
                    <a href="{:url('user/share/zhitui')}"><img src="__STATIC__/hybit/images/tuijian.png" alt=""><p>{:lang('My Recommend')}</p></a>
                    <a href="{:url('user/share/team')}"><img src="__STATIC__/hybit/images/my_wdtd.png" alt=""><p>{:lang('My Team')}</p></a>
                    <a href="{:url('user/share/fenyong')}"><img src="__STATIC__/hybit/images/my_tdfy.png" alt=""><p>{:lang('Team Commission')}</p></a>
                    <a href="{:url('user/share/director')}"><img src="__STATIC__/hybit/images/dongshi.png" alt=""><p>{:lang('Directors dividends')}</p></a>
                    <a href="{:url('user/parent_son/index')}"><img src="__STATIC__/hybit/images/guanlian.png" alt=""><p>{:lang('Related trade')}</p></a>
                    <a href="{:url('user/about/index')}"><img src="__STATIC__/hybit/images/my_gywm.png" alt=""><p>{:lang('About Us')}</p></a>
                    <a href="{:url('user/index/logout')}"><img src="__STATIC__/hybit/images/my_tczh.png" alt=""><p>{:lang('Sign Out')}</p></a>
                </div>
            </div>
        </div>
    </div>
    <div class="alertdiv" id="changename" style="display:none;z-index:100;">
        <form action="" method="post" class="layui-form">
        <div class="cname">
            <p>{:lang('Modify')}{:lang('USERNAME')}</p>
            <input type="text" name="user_nickname" placeholder="{:lang('Please Enter')}{:lang('USERNAME')}">
            <div class="cnamebtnall">
                <button type="button" class="cnamebtn1" onclick="showalert(this)">{:lang('Cancel')}</button>
                <button class="cnamebtn2" lay-submit>{:lang('Confirm')}</button>
            </div>
        </div>
        </form>
    </div>
    <include file="public@navbar">
    <script src="__STATIC__/hybit/js/jquery.min.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script type="text/javascript">
    function showalert(){
        $('#changename').fadeToggle(100);
    }
    layui.use(['form','layer','upload'],function(){
        var layer = layui.layer,
            form = layui.form,
            upload = layui.upload;

        //监听提交
        form.on('submit', function(data){
            var _this = $(this);
            _this.attr("disabled",true);
            $.ajax({
                type: 'post',
                url: '{:url("user/profile/editPost")}',
                data: data.field,
                success:function(res){
                    layer.msg(res.msg)
                    if(res.code == 1){
                        setTimeout(function(){ location.reload(); }, 1500);
                    }else{
                        _this.removeAttr("disabled");
                    }
                }
            });
            return false;
        });

        upload.render({
            elem: '#header',
            accept: 'images',
            acceptMime: 'image/*',
            url: '{:url("user/asset/webuploader")}',
            before: function(obj){
                layer.load();
                obj.preview(function(index, file, result){
                    $('#header').attr('src', result); //图片链接（base64）
                });
            },
            done: function(res){
                //上传完毕回调
                layer.closeAll('loading');
                $.ajax({
                    type: 'post',
                    url: '{:url("user/profile/avatarUpdate")}',
                    data: {avatar:res.data.filepath},
                    success:function(result){
                        layer.msg(result.msg);
                    }
                });
            }
        });
    });
    </script>
</body>
</html>